﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using HotelManagement._04.OBJECT;

namespace HotelManagement._03.DAO
{
    class DestroyRevervationDAO
    {
        DbConnection m_conn;
        SqlCommand m_command;
        SqlDataAdapter m_adap;

        public DestroyRevervationDAO()
        {
            m_conn = new DbConnection();
        }
        public bool CheckInInsert(DestroyRevervation ip_Destroy, string ip_procedure)
        {
            try
            {
                m_command = new SqlCommand(ip_procedure, m_conn.Connect());
                m_command.CommandType = CommandType.StoredProcedure;
                m_command.Parameters.Add("@CheckOutID", SqlDbType.BigInt).Value = ip_Destroy.CheckOutID;
                m_command.Parameters.Add("@CustomerID", SqlDbType.BigInt).Value = ip_Destroy.CustomerID;
                m_command.Parameters.Add("@RoomID", SqlDbType.NVarChar).Value = ip_Destroy.RoomID;
                m_command.Parameters.Add("@RentCost", SqlDbType.BigInt).Value = 0;
                m_command.Parameters.Add("@UserID", SqlDbType.BigInt).Value = AssetsGS.instance.UserId;
                m_command.Parameters.Add("@DepositCost", SqlDbType.BigInt).Value = ip_Destroy.DepositCost;
                m_command.Parameters.Add("@Fines", SqlDbType.BigInt).Value = ip_Destroy.Fines;
                m_command.Parameters.Add("@Note", SqlDbType.NVarChar).Value = ip_Destroy.Note;
                m_command.Parameters.Add("@CheckOutDate", SqlDbType.DateTime).Value = ip_Destroy.CheckOutDate;
                m_adap = new SqlDataAdapter(m_command);
                m_command.ExecuteNonQuery();
                m_conn.Close();
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.ToString());
                return false;
            }
            return true;
        }
    }
}
